import axios from 'axios'
import store from 'src/store/index.js';
//import cookie from 'js-cookie'
// 创建axios实例
const service = axios.create({
  baseURL: 'http://localhost:8001', // api的base_url
  timeout: 300000 // 请求超时时间
})

service.interceptors.request.use(
  config=>{
     if( store.state.userinfo.token!=''){
      config.headers['token']= store.state.userinfo.token;
     }
    return config
  },
  error => {
    return Promise.reject(err);
  }
)
export default service
